package com.qingrongby.shop;

public class MyThread extends Thread {

    private String name;

    private Object co;

    public MyThread(String name,Object o){
        this.name=name;
        this.co=o;
    }

    @Override
    public void run() {
        System.out.println(name+" is waiting.");
        try{
            synchronized (co){
                co.wait();
            }
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
